package Test;

import java.util.Arrays;

/**
 * @author feng
 * @Date 2021/12/24 8:10
 * 合并数组
 *   System.arraycopy
 */
public class Test08 {
    public static void main(String[] args) {
        int[] a = {16, 13, 15, 18};
        int[] b = {29, 36, 100, 9};
        int[] quadratic = solveQuadratic(a, b);
        for (int array : quadratic) {
            System.out.print(array + "\n");
        }

    }

    public static int[] solveQuadratic(int[] eqn, int[] roots) {
        Arrays.sort(eqn);
        Arrays.sort(roots);
        int[] c = new int[eqn.length + roots.length];
        //起始位置
        //目标数量
        System.arraycopy(eqn, 0, c, 0, eqn.length);
        System.arraycopy(roots, 0, c, eqn.length , roots.length);
        Arrays.sort(c);
        return c;
    }
}
